const express = require("express");
const cors = require("cors");
const bodyParser = require('body-parser');
const app = express();
const path = require("path");
const proxyRouter = require("./routes/proxy");
const setConfigRouter = require("./routes/setConfig");
app.use(cors());
app.use(express.static(path.join(__dirname, "dist"))); // 静态文件index.html
app.use(express.static("accets"));
app.use(express.urlencoded({ extended: false }));   // 解析get请求
app.use(express.json()); // 解析post请求
app.use("/", proxyRouter);
app.use("/set", setConfigRouter);
// 启动代理服务器并监听指定端口
const port = 3210;
app.listen(port, () => {
  console.log("代理服务器已启动，监听端口 " + port);
});
